<!--
    page description : 근태관리 - 관리자 - 부서관리 화면 - 사업그룹 등록/수정 (pop_up)
    author      : ych
    date        : 2009-01-09
    file name   : dept_mgr_group_p.jsp
-->
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 1.0 Transitional//EN" "http://www.w3.org/TR/htmL1/DTD/xhtml1-transitional.dtd">
<%@ taglib prefix="s" uri="/struts-tags" %> 

<html>
<head>
<s:head theme="ajax"/>
<link rel="stylesheet" type="text/css" href="/inc/css/common.css" />
<link rel="stylesheet" href="style/style.css" type="text/css" />
<script src="inc/js/common.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
<!-- --------------------J A V A S C R I P T    START-------------------- -->
<script type="text/javascript">
<!--
    //submit 이전에 validation
    //그룹코드 등록 /수정
    function fnc_group_save(f) {
        
        if (!fnc_validate(f)) {
            return false;
        } else if (!confirm("<s:text name="alert.message.questionApply" />")) {
            return false;
        }
        f.action = "update_upper_dept.action"   //form action 설정.
        return true;
    }
    
    function fnc_validate(f) {
        var cnt=0;
        //  사업그룹명이 비어있으면 안됨.
        if (f.upper_dept_nm.value == null || f.upper_dept_nm.value == "" || f.upper_dept_nm.value.length == 0) {
            f.upper_dept_nm.focus();
            alert("<s:text name="alert.message.requiedGroupName" />");
            return false;
        }
        for(var i=0; i<f.upper_dept_nm.value.length; i++){
           if(f.upper_dept_nm.value.charAt(i)==" "){
              cnt++;
           }
        }
        if(f.upper_dept_nm.value.length == cnt){
           alert("공백을 허용하지 않습니다.");
           f.upper_dept_nm.focus();
           return false;
        }
        
        return true;
    }
    
    //사업그룹 수정시 ajax를 적용하여 opener의 죄회 데이터를 바로 적용함.
    function fnc_apply_change() {

        var rtn_msg = document.getElementById("rtn_msg").value;
        
        if(rtn_msg.length != 0)
        {
            alert(rtn_msg);
            window.close();
            opener.call_dojo();
        }
        
    }

//-->
</script>
<!-- --------------------J A V A S C R I P T    E N D-------------------- -->
</head>
<body  onload="fnc_apply_change()">
        <s:form name="frm_group_reg_mod" id="frm_group_reg_mod" method="post" theme="simple" >
            <s:hidden id="rtn_msg" name="rtn_msg"/>
            <input type="hidden"  name="upper_dept_no"  value="<s:property value="upper_dept_no"/>" />     <!-- 사업그룹코드 -->
            	<div id="popup_350se_top"></div>
				<div id="popup_350se_bg">
			    	<div id="popup_325se">
			    		<div id="popup_325se_box">
			    			<ul>
				    			<li class="txt">그룹명</li>
				    			<li><s:textfield id="upper_dept_nm" name="upper_dept_nm" value="%{upper_dept_nm}" cssClass="input_120se" /></li>
			    			</ul>
			    			<ul>
				    			<li class="txt">사용여부</li>
				    			<li><s:select id="use_yn" name="use_yn" value="%{use_yn}" list="#{'Y':'Y', 'N':'N'}" cssClass="combobox120se" /></li>
			    			</ul>
			    			<div id="popup_btn"><input type="image" value="저장" src="/images/btn_save.gif" onclick="return fnc_group_save(this.form)" /></div>
			    		</div>
			    	</div>
	        	</div>
				<!---------------Bottom : STR----------->
				<div id="popup_350se_bottom"><s:submit value="닫기" type='image' src="/images/pop_btn_close.gif" onclick="window.close();" /></div>
				<!---------------Bottom : END----------->                
        </s:form>
    </div>
</body>
</html>